package hms.ReservationsModule;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

import hms.rewards.*;

/*This class controls all displays for managing individual accounts for 
 * rewards members
 * Allows the following functions:
 *  -Set name associated with account
 *  -choose which rewards are applicable with account
 *  -renew/cancel memberships
 *  -set type of account (e.g. monthly, annually)
 *  
 * Displays the following information:
 *  -starting and calculated ending dates for subscription
 *  -points available in account
 *  
 *  @author Edgar Onukwugha*/

public class ManageAccountView {
	MemberAccountControl mac = new MemberAccountControl();
	
	JTextField nameEntry;
	JLabel name, pointsAvailable, membershipType;
	JRadioButton trial, monthly, annually;
	
	//initializes all components used in ManageAccountView
	public JPanel createManageAccountView(){
		//initialize panel encasing all components
		JPanel panel = new JPanel();
		//initialize textfields
		nameEntry = new JTextField(50);
		
		//initialize labels for numbers
		name = new JLabel("Name");
		pointsAvailable = new JLabel("Available Points");
		membershipType = new JLabel("Membership Type");
		
		//initialize radio buttons
		trial = new JRadioButton("Trial");
		monthly = new JRadioButton("Monthly");
		annually = new JRadioButton("Annual");
		
		//place in panel
		panel.add(name);
		panel.add(pointsAvailable);
		panel.add(membershipType);
		panel.add(trial);
		panel.add(monthly);
		panel.add(annually);
		
		//return panel
		return panel;
	}
	
	/*sets all actions for MemberAccountView*/
	public void actionPerformed(ActionEvent e){
		/*sets all actions for trial memberships
		 * will activate respective subscription when changes 
		 * are committed to DB*/
		
		//if 'Trial' is selected, call method from MemberAccountControl
		if(e.getActionCommand() == "Trial"){
			mac.subscriptionStatus();
		}
		//if 'Monthly' is selected
		if(e.getActionCommand() == "Monthly"){
			mac.subscriptionStatus();
		}
		
		if(e.getActionCommand() == "Annual"){
			mac.subscriptionStatus();
		}
		
		/*sets up actions for gathering name from GUEST database*/
	}
}
